package com.zx.server.util;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

public class ResponseEntityHelper {

	public static ResponseEntity<ResponseModel> createResponse(Integer code, String message, Object data) {
		ResponseModel res = new ResponseModel();
		res.setCode(code);
		res.setMessage(message);
		res.setData(data);
		return new ResponseEntity<ResponseModel>(res, HttpStatus.OK);
	}

	public static ResponseEntity<ResponseModel> createResponse(Integer code, String message) {
		ResponseModel res = new ResponseModel();
		res.setCode(code);
		res.setMessage(message);
		res.setData(null);
		return new ResponseEntity<ResponseModel>(res, HttpStatus.OK);
	}

	public static ResponseEntity<ResponseModel> createResponse(Object data) {
		ResponseModel res = new ResponseModel();
		res.setCode(ServiceCode.SUCCESS);
		res.setMessage("");
		res.setData(data);
		return new ResponseEntity<ResponseModel>(res, HttpStatus.OK);
	}
}
